package com.aaa.service.impl;

import com.aaa.mapper.StudentMapper;
import com.aaa.pojo.Student;
import com.aaa.service.StudentService;
import com.aaa.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentMapper studentMapper;
    @Override
    public Result queryById(Integer sId) {
        Student byId = studentMapper.findById(sId);
        return new Result(200,"查询学生成功",byId);
    }

    @Override
    public Result queryAll() {
        List<Student> all = studentMapper.findAll();
        return new Result(200,"查询所有",all);
    }

    @Override
    public void insert(Student student) {
        studentMapper.insert(student);
    }

    @Override
    public void deleteById(Integer sId) {
        studentMapper.deleteById(sId);
    }

    @Override
    public void update(Student student) {
        studentMapper.update(student);
    }
}
